<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
      <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
  <div id="app">
    <p @click="addCount">count:{{count}}</p>
  </div>
</body>
</html>

<script>
  //选项式语法

  // const{createApp} = Vue;
  // const vm = createApp({
  //   data(){
  //     return{
  //       arr: ['刘备', '关羽', '张飞']
  //     }
  //   },
  //   methods:{
  //     addHero(){
  //       vm.arr.push('诸葛亮')
  //     }
  //   }
  // }).mount('#app')


//组合式语法

const {createApp, ref} = Vue;

const vm = createApp({
  //该语法不建议这样写
  setup(){
    //该位置就可以写组合式的语法
    const count = ref(100)
    const addCount = () =>{
      console.log(count);
      count.value++;
    }
    return{
      count,
      addCount
    }
  }
}).mount('#app')

</script>